﻿namespace Liphofra.Mvvm.Validation
{
    /// <summary>
    /// Describes a validation rule's behavior and properties.
    /// </summary>
    public interface IValidationRule
    {
        /// <summary>
        /// Validates the specified target.
        /// </summary>
        /// <typeparam name="T">The type of the target.</typeparam>
        /// <param name="target">The target to validate.</param>
        /// <returns>A single validation result indicating the result of the validation.</returns>
        ValidationResult Validate<T>(T target);

        /// <summary>
        /// Validates the specified property of the target.
        /// </summary>
        /// <typeparam name="T">The type of the target.</typeparam>
        /// <param name="target">The target to validate.</param>
        /// <param name="propertyName">The name of the property to validate.</param>
        /// <returns>
        /// A single validation result indicating the result of the validation.
        /// </returns>
        ValidationResult ValidateProperty<T>(T target, string propertyName);
    }
}